package uutalk.netcloud.talk.model.bean;

import android.support.annotation.NonNull;

import com.alibaba.fastjson.annotation.JSONField;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;

import java.io.Serializable;

/**
 * Created by hujie on 17/4/10.
 */
@Entity
public class GroupMember implements Serializable, Comparable<GroupMember>{

    static final long serialVersionUID = 42L;

    @Id
    private String user_id;
    private String user_name;
    private String user_picture;
    private String user_type;
    private String user_phone;
    private String user_status = "0";
    private String group_id;//所在群组id

    @Generated(hash = 281134052)
    public GroupMember(String user_id, String user_name, String user_picture, String user_type, String user_phone, String user_status,
                       String group_id) {
        this.user_id = user_id;
        this.user_name = user_name;
        this.user_picture = user_picture;
        this.user_type = user_type;
        this.user_phone = user_phone;
        this.user_status = user_status;
        this.group_id = group_id;
    }

    @Generated(hash = 1668463032)
    public GroupMember() {
    }

    public String getUser_status() {
        return user_status;
    }

    public void setUser_status(String user_status) {
        this.user_status = user_status;
    }


    public String getUser_phone() {
        return user_phone;
    }

    public void setUser_phone(String user_phone) {
        this.user_phone = user_phone;
    }

    public String getUser_type() {
        return user_type;
    }

    public void setUser_type(String user_type) {
        this.user_type = user_type;
    }

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public String getUser_picture() {
        return user_picture;
    }

    public void setUser_picture(String user_picture) {
        this.user_picture = user_picture;
    }



    public String getGroup_id() {
        return group_id;
    }

    public void setGroup_id(String group_id) {
        this.group_id = group_id;
    }

    @Override
    public String toString() {
        return "GroupMember{" +
                "user_id='" + user_id + '\'' +
                ", user_name='" + user_name + '\'' +
                ", user_picture='" + user_picture + '\'' +
                ", user_type='" + user_type + '\'' +
                ", user_phone='" + user_phone + '\'' +
                ", user_status='" + user_status + '\'' +
                ", group_id='" + group_id + '\'' +
                '}';
    }

    @Override
    public int compareTo(@NonNull GroupMember groupMember) {
        if("1".equals(this.getUser_type())){
            return -1;
        } else {
            if("1".equals(groupMember.getUser_type())){
                return 1;
            } else if("1".equals(this.getUser_status())){
                return -1;
            } else if("1".equals(groupMember.getUser_status())){
                return 1;
            } else {
                return 0;
            }
        }
    }
}
